import java.util.Arrays;

public class Solution2028 {
    public int[] missingRolls(int[] rolls, int mean, int n) {
        int target=mean*(rolls.length+n)- Arrays.stream(rolls).sum();
        if (target<n || target>n*6){
            return new int[0];
        }
        int[] ans=new int[n];
        int s=n;
        for (int i=0;i<n;i++){
            int j=target/s;
            ans[i]=j;
            s--;
            target-=j;
        }
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(Arrays.toString(new Solution2028().missingRolls(new int[]{3, 4, 2, 3}, 4, 2)));
    }
}
